﻿using Compass.Wasm.Shared.Categories;
using Zack.DomainCommons.Models;

namespace Compass.CategoryService.Domain.Entities;

public record DrawingNumber : AggregateRootEntity
{
    public string Name { get; private set; } //图号
    public string? Description { get; private set; } //描述
    public DrawingType_e Type { get; private set; }
    public string? Remarks { get; private set; }
    public string? ImageUrl { get; private set; }

    private DrawingNumber() { }
    public DrawingNumber(Guid id,string name,string? description,DrawingType_e type,string? remarks,string? imageUrl)
    {
        Id = id;
        Name= name;
        Description = description;
        Type = type;
        Remarks= remarks;
        ImageUrl = imageUrl;
    }

    #region Update
    public void Update(DrawingNumberDto dto)
    {
        ChangeName(dto.Name)
            .ChangeDescription(dto.Description)
            .ChangeType(dto.Type)
            .ChangeRemarks(dto.Remarks)
            .ChangeImageUrl(dto.ImageUrl);

        NotifyModified();
    }
    public DrawingNumber ChangeName(string name)
    {
        Name=name;
        return this;
    }
    public DrawingNumber ChangeDescription(string? description)
    {
        Description=description;
        return this;
    }
    public DrawingNumber ChangeType(DrawingType_e type)
    {
        Type=type;
        return this;
    }
    public DrawingNumber ChangeRemarks(string? remarks)
    {
        Remarks=remarks;
        return this;
    }
    public DrawingNumber ChangeImageUrl(string? imageUrl)
    {
        ImageUrl=imageUrl;
        return this;
    }
    #endregion

}